﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BotonJXC.Entity;

namespace BotonJXC.Forms.Events
{
    public delegate void ProductSelectedEventHandler(object sender, ProductSelectedEventArgs e);
    public class ProductSelectedEventArgs : EventArgs
    {
        IList<Product> _selectedProducts = null;
        public ProductSelectedEventArgs(Product selectedProduct)
        {
            SelectedProducts.Add(selectedProduct);
        }
        public ProductSelectedEventArgs(IList<Product> selectedProducts)
        {
            _selectedProducts = selectedProducts;
        }
        public Product SelectedProduct
        {
            get
            {
                if (_selectedProducts != null && _selectedProducts.Count > 0)
                    return _selectedProducts[0];
                else
                    return null;
            }
        }
        public IList<Product> SelectedProducts
        {
            get
            {
                if (_selectedProducts == null)
                    _selectedProducts = new List<Product>();
                return _selectedProducts;
            }
        }
    }
}
